/*
 * Copyright (c) 2017 zhangcm. All Rights Reserved.
 */
package com.jnzc.ocr.serv.shop.helper;

import com.google.common.base.Optional;
import com.jnzc.ocr.serv.shop.entity.ShopGoodsSku;

import java.util.List;

/**
 * @author zhangcm
 * @version 1.0, 2017/12/10
 */
public class ShopGoodsSkuHelper {

    private ShopGoodsSkuHelper() {}

    public static List<ShopGoodsSku> init(List<ShopGoodsSku> skuList) {
        for (ShopGoodsSku obj : skuList) {
            init(obj);
        }
        return skuList;
    }

    public static ShopGoodsSku init(ShopGoodsSku obj) {
        obj.setSaleNum(Optional.fromNullable(obj.getSaleNum()).or(0));
        obj.setStockNum(Optional.fromNullable(obj.getStockNum()).or(0));
        return obj;
    }
}
